from django.conf import settings
from django.shortcuts import render
from django.views import View

from courses.models import Course


class CourseList(View):
    def get(self, request):
        all_courses = Course.objects.all()
        return render(request, 'course-list.html', {'all_courses': all_courses})


class CourseDetail(View):
    def get(self, reuqest, pk):
        course = Course.objects.get(pk=pk)
        return render(reuqest, 'course-detail.html', {'course': course,'MEDIA_URL':settings.MEDIA_URL})
